package com.myblog.entity.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.myblog.constant.Roles;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 功能: 用户传输对象
 * 作者: 沙琪马
 * 日期: 2024/6/21 20:06
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "用户传输对象类")
public class UserDTO {
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "用户id")
    private Long id;
    @Schema(description = "用户名")
    private String username;
    @Schema(description = "密码")
    private String password;
    @Schema(description = "邮箱")
    private String email;
    @Enumerated(EnumType.STRING) // 将枚举类型的角色字段映射为字符串存储
    private String role = Roles.USER; // 默认角色为普通用户
    @Schema(description = "创建时间")
    private LocalDateTime createdAt;
    @Schema(description = "更新时间")
    private LocalDateTime updatedAt;
    @Schema(description = "验证码")
    private String verificationCode;
}
